﻿/// <reference path="../typings/jquery/jquery.d.ts" />
import Album = require("Models/Album");
import Photo = require("Models/Photo");

class Server {
    
    public static getAlbums = (
        onSuccess: (response: Album[]) => void,
        onFailure: (err: JQueryXHR) => void
        ) : void => {
        $.ajax({
            type: "GET",
            dataType: "json",
            url: "/api/Photos/GetAlbums",
            success: onSuccess,
            failure: onFailure
        });
    };

    public static getPhotosInAlbum = (
        albumId: string,
        onSuccess: (response: Photo[]) => void,
        onFailure: (err: JQueryXHR) => void
        ) :void => {
        $.ajax({
            type: "GET",
            dataType: "json",
            url: "/api/Photos/GetPhotosInAlbum?albumId=" + albumId,
            success: onSuccess,
            failure: onFailure
        });
    };
}

export = Server;